package com.yootk;
import java.util.Scanner;
public class StudentManagement {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Student[] students = new Student[3];

        System.out.println("请输入3名学生的信息");

        for (int i = 0; i < 3; i++) {
            System.out.println("请输入第 " + (i + 1) + " 名学生的信息：");
            System.out.print("学号：");
            int id = scanner.nextInt();
            scanner.nextLine();
            System.out.print("姓名：");
            String name = scanner.nextLine();
            System.out.print("年龄：");
            int age = scanner.nextInt();
            scanner.nextLine();

            students[i] = new Student(id, name, age);
        }

        System.out.println("\n--- 所有学生信息如下 ---");
        for (Student student : students) {
            System.out.println(student);
        }

        System.out.println("\n--- equals 和 hashCode 验证 ---");

        Student s1 = new Student(1, "helen", 23);
        Student s2 = new Student(1, "helen", 23);

        System.out.println("s1.equals(s2) 的结果应该是 true：" + s1.equals(s2));
        System.out.println("s1.hashCode() == s2.hashCode() 的结果应该是 true：" +
                (s1.hashCode() == s2.hashCode()));

        scanner.close();
    }
}
